import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:todo_app/constants/Screen.dart';
import 'package:todo_app/controllers/definitions/RtcRoomModel.dart';
import 'package:todo_app/layout/Gaps.dart';
import 'package:todo_app/pages/person/component/UserCard.dart';
import 'package:todo_app/utils/call/CallHelper.dart';
import 'package:todo_app/utils/webrtc/section/CallIcons.dart';

class CallOutSection extends HookWidget {
  const CallOutSection(this.room, {Key? key}) : super(key: key);
  final RtcRoomModel room;

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      backgroundColor: const Color(0xFF1a3d4d),
      body: Container(
        width: Screen.width,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            const SizedBox(height: 168,),
            UserAvatar(size: 120, url: room.callee.avatar),
            Gaps.vGap16,
            Text("正在等待${room.callee.nickname ?? "用户"}接听…", style: TextStyle(color: Colors.white, fontSize: 12.dp) ),
            const Spacer(),
            GestureDetector(
              onTap: () {
                CallUIHelper.handUp(room.room_id!);
              },
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  const CallEndIcon(),
                  Gaps.vGap12,
                  const Text("取消", style: TextStyle(color: Colors.white),)
                ],
              ),
            ),
            SizedBox(height: 120.dp,)
          ]
        ),
      ),
    );
  }
}